package com.example.demo04.controller;

import com.example.demo04.entity.ImgUrl;
import com.example.demo04.entity.pojo.AdvancedGeneralPo;
import com.example.demo04.services.BaiDuApiService;
import com.example.demo04.until.Result;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author taritari
 * @date 2023-10-22 20:05
 * @description
 */
@RestController
@RequestMapping("/baiduApi")
public class BaiDuApiController {
    @Resource
    private BaiDuApiService baiDuApiService;

    @GetMapping("/getToken")
    public String getToken(){
        String token = baiDuApiService.getToken();
        return token;
    }

    @PostMapping("/advancedGeneral")
        public Result advancedGeneral(@RequestBody ImgUrl url){
        List<AdvancedGeneralPo> advanceGeneral = baiDuApiService.getAdvanceGeneral(url.url);
        return Result.success(advanceGeneral);
    }
}
